﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using THenu.TinyHourseLib.DesignPattern.Specification_Pattern.Example;
using THenu.TinyHourseLib.DesignPattern.Abstract_Factory_Pattern;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
using System.Text;
using System.Diagnostics;


namespace THenu.TinyHourseLib
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // 重定向输入输出流
            //MemoryStream msOut = new MemoryStream();
            //StreamWriter swStandardOutput = new StreamWriter(msOut, Encoding.Unicode);
            //swStandardOutput.AutoFlush = true;
            //Console.SetOut(swStandardOutput);

            //MemoryStream msInput = new MemoryStream();
            //StreamReader swStandardInput = new StreamReader(msInput, Encoding.Unicode);
            //Console.SetIn(swStandardInput);

            //THenu.TinyHourseLib.DesignPattern.Specification_Pattern.Example.BeautyGirl.WhoIsZhengBingBing();

            

            //FrmHenuConsole frmConsole = new FrmHenuConsole(null, null);

            try
            {
           

                Application.Run(new Snip_DragNDrop());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //msOut.Close();

            //msInput.Close();
        }
    }

    //static class Program
    //{
    //    [DllImport("kernel32.dll", EntryPoint = "GetStdHandle", SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
    //    private static extern IntPtr GetStdHandle(int nStdHandle);
    //    [DllImport("kernel32.dll", EntryPoint = "AllocConsole", SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
    //    private static extern int AllocConsole();
    //    private const int STD_OUTPUT_HANDLE = -11;
    //    private const int MY_CODE_PAGE = 437;

    //    static void Main(string[] args)
    //    {
    //        Console.WriteLine("This text you can see in debug output window.");

    //        AllocConsole();
    //        IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
    //        SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true);
    //        FileStream fileStream = new FileStream(safeFileHandle, FileAccess.Write);
    //        Encoding encoding = System.Text.Encoding.GetEncoding(MY_CODE_PAGE);
    //        StreamWriter standardOutput = new StreamWriter(fileStream, encoding);
    //        standardOutput.AutoFlush = true;
    //        Console.SetOut(standardOutput);

    //        Console.WriteLine("This text you can see in console window.");

    //        MessageBox.Show("Now I'm happy!");
    //    }
    //}
}
